﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>字符^的使用</title>
</head>
<body>
    <h3>行首匹配字符^的使用</h3>
    <script>
        var reg_expression = /^mi/;  				//使用行首元字符
        var textString = "microsoft";
        var result = reg_expression.test(textString);
        document.write("<font size='+1'>" + result + "</font>");
        if (result) {
            document.write("正则表达式/^mi/匹配字符串\"" + textString + "\".<br>");
        }
        else {
            alert("未找到匹配的模式!");
        }

    </script>

</body>
</html>